/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page1={
    create:function () {
    var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        var bg=Easy.CreateSprite('assets/images/p1_bg.png',0,0,0,0,1);
        page.ui.addChild(bg);

        var d0=Easy.CreateSprite('assets/images/p1_d0.png',-266,-32,0,0,0.5);
        page.ui.addChild(d0);
        TweenMax.to(d0,10,{x:-210,yoyo:true,repeat:-1,repeatDelay:1,ease:Linear.easeNone});
        TweenMax.to(d0,2,{alpha:1,yoyo:true,repeat:-1,repeatDelay:0.5,ease:Linear.easeNone});

        var tip=Easy.CreateSprite('assets/images/tip.png',367,1076,0.5,0.5,1);
        page.ui.addChild(tip);
        TweenMax.to(tip,0.7,{y:1100,yoyo:true,repeat:-1,ease:Cubic.easeInOut});

        var title=Easy.CreateSprite('assets/images/p1_title.png',370,45,0.5,0.5,1);
        var i0=Easy.CreateSprite('assets/images/p1_i0.png',179,295,0.5,0.5,1);
        var i1=Easy.CreateSprite('assets/images/p1_i1.png',515,216,0.5,0.5,1);
        var i2=Easy.CreateSprite('assets/images/p1_i2.png',208,661,0.5,0.5,1);
        var i3=Easy.CreateSprite('assets/images/p1_i3.png',558,675,0.5,0.5,1);
        var i4=Easy.CreateSprite('assets/images/p1_i4.png',367,991,0.5,0.5,1);
        var light0=Easy.CreateSprite('assets/images/light0.png',577,327,0.5,0.5,1);
        light0.scale.x=light0.scale.y=0;
        light0.blendMode=PIXI.BLEND_MODES.ADD;

        var light1=Easy.CreateSprite('assets/images/light1.png',547,176,0.5,0.5,0.5);
        light1.scale.x=light1.scale.y=0;
        light1.blendMode=PIXI.BLEND_MODES.ADD;

        page.ui.addChild(title);
        page.ui.addChild(i0);
        page.ui.addChild(i1);
        page.ui.addChild(i2);
        page.ui.addChild(i3);
        page.ui.addChild(i4);
        page.ui.addChild(light0);
        page.ui.addChild(light1);


        page.In=function () {
            console.log('in');
            title.alpha=0;
            i0.alpha=0;
            i0.x=179-100;
            i1.alpha=0;
            i1.x=515+100;
            i2.alpha=0;
            i2.x=208-100;
            i3.alpha=0;
            i3.x=558+100;
            i4.alpha=0;
            i4.y=991+100;
            TweenMax.to(title,0.9,{delay:0.3*0,alpha:1,ease:Cubic.easeOut});
            TweenMax.to(i0,0.9,{delay:0.3*0,alpha:1,x:179,ease:Cubic.easeOut});
            TweenMax.to(i1,0.9,{delay:0.3*1,alpha:1,x:515,ease:Cubic.easeOut});
            TweenMax.to(i2,0.9,{delay:0.3*2,alpha:1,x:208,ease:Cubic.easeOut});
            TweenMax.to(i3,0.9,{delay:0.3*3,alpha:1,x:558,ease:Cubic.easeOut});
            TweenMax.to(i4,0.9,{delay:0.3*4,alpha:1,y:991,ease:Cubic.easeOut});
            light1.scale.x=light1.scale.y=0;
            TweenMax.to(light1.scale,0.5,{delay:1.2,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(light1,1,{alpha:1,yoyo:true,repeat:-1,repeatDelay:0.5,ease:Cubic.easeInOut});

            light0.scale.x=light0.scale.y=0;
            TweenMax.to(light0.scale,0.5,{delay:1.4,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(light0,3,{x:477,yoyo:true,repeat:-1,repeatDelay:1,ease:Linear.easeNone});
        }
        page.Out=function () {
            console.log('out');
            TweenMax.killTweensOf(title);
            TweenMax.killTweensOf(i0);
            TweenMax.killTweensOf(i1);
            TweenMax.killTweensOf(i2);
            TweenMax.killTweensOf(i3);
            TweenMax.killTweensOf(i4);
            TweenMax.killTweensOf(light0);
            TweenMax.killTweensOf(light1);
            setTimeout(function () {
                title.alpha=0;
                i0.alpha=0;
                i1.alpha=0;
                i2.alpha=0;
                i3.alpha=0;
                i4.alpha=0;
                light0.scale.x=light0.scale.y=0;
                light1.scale.x=light1.scale.y=0;
            })

        }

       
    return page;
    }
}